/*
 * SonarQube
 * Copyright (C) 2009-2017 SonarSource SA
 * mailto:info AT sonarsource DOT com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
@import (reference) "../mixins";
@import (reference) "../variables";
@import (reference) "ui";

@navbarGlobalBackground: #262626;
@navbarContextBackground: @barBackgroundColor;

@navbarLineHeight: 20px;
@navbarTopPadding: (@navbarGlobalHeight - @navbarLineHeight) / 2;

.navbar, [class^="navbar-"], [class*=" navbar-"] {
  box-sizing: border-box;
}

.navbar {
  position: fixed;
  left: 0;
  right: 0;
  .clearfix;
  height: @navbarGlobalHeight;
}

.navbar-fade {
  .navbar-nav {
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  .navbar-favorite {
    margin-right: -23px;
    transition: margin 0.2s ease;
  }

  &.in {
    .navbar-nav {
      opacity: 1;
    }

    .navbar-favorite {
      margin-right: 0;
    }
  }
}

.navbar a {
  .link-no-underline;
  transition: none;
}

.navbar-header {
  float: left;
}

.navbar-brand {
  display: block;

  img {
    vertical-align: top;
  }
}

.navbar-brand-custom {
  padding: 0 10px;
}

.navbar-nav {
  float: left;
}

.navbar-nav > li {
  float: left;
}

.navbar-nav > li > a {
  padding: @navbarTopPadding 10px;
  line-height: @navbarLineHeight;

  &.navbar-avatar {
    margin-right: 7px;
    padding: 3px;
  }

  &.navbar-help {
    line-height: 16px;
    padding: 7px;
  }
}

.navbar-nav > li.navbar-more > a {
  padding-right: 17px;
}

.navbar-nav > li.navbar-more + li {
  margin-left: -17px;
}

.navbar-nav > li.navbar-more + li > a {
  padding-left: 5px;
  padding-right: 5px;
}

.navbar-icon:before {
  color: #fff !important;
  font-size: @iconFontSize;
}

.navbar-favorite {
  position: relative;
  top: -2px;
}

.navbar-right {
  float: right;
}

.navbar-search {
  position: relative;
  padding-right: 3px;
}

.navbar-search-input {
  vertical-align: middle;
  width: 310px;
  margin-top: 3px;
  margin-bottom: 3px;
  padding-left: 26px !important;
}

.navbar-search-input-hint {
  position: absolute;
  top: 4px;
  right: 30px;
  line-height: @formControlHeight;
  font-size: 12px;
  color: @secondFontColor;

  &.is-shifted {
    z-index: @dropdown-menu-z-index + 1;
    top: 32px;
  }
}

.navbar-search-icon {
  position: relative;
  vertical-align: middle;
  width: 16px;
  margin-right: -20px;
  color: @secondFontColor;

  &:before {
    font-size: @iconSmallFontSize;
  }
}

.navbar-search-item-link {
  display: flex !important;
}

.navbar-search-item-match {
  flex-grow: 5;
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar-search-item-right {
  flex-grow: 1;
  padding-left: 10px;
  text-align: right;
}

.navbar-search-item-icons {
  position: relative;
  flex-shrink: 0;
  width: 16px;
  height: 16px;

  > * {
    position: absolute;
    z-index: 5;
    top: 0;
    left: 0;
  }

  > .icon-star,
  > .icon-clock {
    z-index: 6;
    top: -4px;
    left: -5px;
  }
}

.navbar-search-shortcut-hint {
  line-height: 16px;
  margin-top: 5px;
  padding: 5px 10px;
  border-top: 1px solid #e6e6e6;
  background-color: #f3f3f3;
  color: #777;
  font-size: 11px;
}

.navbar-search-no-results {
  margin-top: 4px;
  padding: 5px 10px;
}

.navbar-global {
  top: 0;
  z-index: @navbar-global-z-index;
  background-color: @navbarGlobalBackground;

  .navbar-nav > li > a {
    color: #ccc;
    font-size: 12px;
    letter-spacing: 0.05em;

    &:hover {
      color: #fff;
    }
  }

  .navbar-nav > .active > a,
  .navbar-nav > li > a.active,
  .navbar-nav > .dropdown.open > a {
    color: #fff;
  }

  .navbar-brand:hover,
  .navbar-brand:focus {
    background-color: darken(@navbarGlobalBackground, 20%);
  }

  .navbar-nav > li > a:hover,
  .navbar-nav > .active > a,
  .navbar-nav > li> a.active,
  .navbar-nav > .dropdown.open > a {
    background-color: @blue;
  }

  .navbar-search-dropdown {
    background-color: @blue !important;
  }

  .navbar-admin-link:hover,
  .active > .navbar-admin-link,
  .active.navbar-admin-link {
    background-color: @orange !important;
  }
}


.navbar-context {
  position: static;
  top: @navbarGlobalHeight;
  z-index: @navbar-context-z-index;
  height: @navbarContextHeight;
  padding: 0;
  background-color: @navbarContextBackground;

  .nav-tabs {
    width: 100%;
  }

  .navbar-nav > li > a {
    padding-top: 3px;
    padding-bottom: 3px;
  }

  .navbar-admin-link:hover,
  .navbar-admin-link:focus,
  .active > .navbar-admin-link {
    border-color: @orange !important;
  }
}

.navbar-context-favorite {
  float: left;
  padding: 7px 0 0 10px;
}

.navbar-context-meta {
  position: absolute;
  top: 0;
  right: 0;
  line-height: @navbarGlobalHeight;
  padding: 5px 10px 0;
  color: @secondFontColor;
  font-size: @smallFontSize;
  text-align: right;
}

.navbar-context-description {
  float: left;
  line-height: @formControlHeight;
  padding-top: 4px;
  padding-left: 4px;
  color: @secondFontColor;
  font-size: @smallFontSize;
}

.navbar-context-inner {
  position: fixed;
  z-index: 420;
  left: 0;
  right: 0;
  height: 65px;
  padding-top: 5px;
  box-sizing: border-box;
  background-color: #f3f3f3;
}

.navbar-context-title {
  float: left;
  min-height: 30px;
  padding: 2px 10px 0;
}

.navbar-context-title-qualifier {
  display: inline-block;
  line-height: 16px;
  padding-top: 5px;
  box-sizing: border-box;
}


.navbar-side {
  padding: 10px;
  border-bottom: 1px solid @barBorderColor;
  background-color: #e5f1f9;
}


.global-navbar-search-dropdown {
  max-height: 80vh;
  width: 440px;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: @defaultShadow;
}
